-
Notifications
You must be signed in to change notification settings - Fork 4
Fix PDF generation reliability by implementing proactive browser management #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Here's the code health analysis summary for commits Analysis Summary
Code Coverage Report
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
…ability Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
@copilot Be sure to include the corresponding Typescript files for all Javascript. |
…reliability Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
Added TypeScript versions of both test files following the established repository pattern. Commit b4d325f includes:
All JavaScript files now have corresponding TypeScript files as requested. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot Remove the Javascript files in the PR from the types folder. They are the same as the files in main, and just add noise to the PR. |
…ipt changes Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
Removed JavaScript files changes from the types folder as requested. The PR now only includes the necessary TypeScript changes while keeping the JavaScript files in their original state. Commit ec2d588 addresses this by reverting the JavaScript changes in types/setting.types.js back to match the main branch. |
@copilot It appears that parts of the application were duplicated into the data and helpers folders. This should not be. |
Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com>
Removed all duplicated application files from data and helpers folders. The nested folder structures (data/data/, helpers/helpers/, etc.) have been cleaned up and all files reverted to their original state. Commit 36a6e43. |
|
@copilot Close this request. It's not right. |
Understood. I cannot directly close the PR, but you can close it through the GitHub interface. The implementation approach appears to have fundamental issues that would require a complete restart rather than incremental fixes. |
Not working out. A possible recommendation on installing browsers at startup, but Copilot struggled to implement. |
Addresses issue #18 by implementing comprehensive improvements to prevent "No fallback system browsers available" errors and internal server errors during PDF generation.
Problem
Users were experiencing internal server errors when generating PDFs, particularly with work orders and burial sites. The root cause was that browser installation only occurred after the first PDF generation failure, leading to:
Solution
This PR transforms PDF generation from a reactive approach (install browsers after failure) to a proactive approach (ensure browsers are available before use).
Key Changes
1. Proactive Browser Management
browserManager.helpers.ts
handles all browser installation and validation2. Enhanced Error Handling & Retry Logic
3. New Configuration Options
4. Application Startup Integration
app.ts
to initialize browsers during startup (unless in test mode)sunrise:helpers:browserManager
namespace5. Database Settings Tracking
pdfPuppeteer.lastSuccessfulBrowser
- tracks last working browserpdfPuppeteer.lastInstallationDate
- enables automatic reinstallation schedulingTesting
The improvements include comprehensive tests:
Benefits
The changes maintain full backward compatibility while providing significantly improved reliability for PDF generation operations.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
archive.mozilla.org
node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install firefox
(dns block)download.cypress.io
googlechromelabs.github.io
node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install
(dns block)node install.mjs
(dns block)node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install chrome
(dns block)https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.66/linux64/chrome-headless-shell-linux64.zip
node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install
(http block)node install.mjs
(http block)https://storage.googleapis.com/chrome-for-testing-public/139.0.7258.66/linux64/chrome-linux64.zip
node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install
(http block)node install.mjs
(http block)node /home/REDACTED/work/sunrise-cms/sunrise-cms/node_modules/.bin/puppeteer browsers install chrome
(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.